package com.itheima.test2;

public class MyThread extends Thread{

    static int count=100;
    @Override
    public void run() {
        while(true){
            synchronized(MyThread.class){
                if(count<10){
                    break;
                }else {
                    count--;
                    System.out.println(Thread.currentThread().getName()+"正在送第"+(100-count)+"份礼物");
                    try {
                        Thread.sleep(10);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }
    }
}
